<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%-- <%@ include file="../common/common.jsp" %> --%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<script src="./ckeditor/ckeditor.js"></script>

<script type="text/javascript">
	var editContentType = 0;
	function zongban(){
		$("#sendTempbanbulx").val("");
		$("#sendTempbanbulx").val("总颁");
		$("#sendzbss").css("display","block");
		//$("#suitableFor1").css("disabled",false);
		$("#sendsbss").css("display","none"); 
	}
	function shengban(){
		$("#sendTempbanbulx").val("");
		$("#sendTempbanbulx").val("省颁");
		//$("#suitableFor1").css("disabled",true);
		//适用省份下拉框
		$("#sendzbss").css("display","none");
		$("#sendsbss").css("display","block"); 
	}
	function openEmail(){
		document.getElementById("toEmailFile").style.display="block";
		document.getElementById("toMessageFile").style.display="none";
		document.getElementById("toWXFile").style.display="none";
		editContentType=1;
	}
	function openMessage(){
		document.getElementById("toEmailFile").style.display="none";
		document.getElementById("toMessageFile").style.display="block";
		document.getElementById("toWXFile").style.display="none";
		editContentType=2;
	}
	function openWX(){
		document.getElementById("toEmailFile").style.display="none";
		document.getElementById("toMessageFile").style.display="none";
		document.getElementById("toWXFile").style.display="block";
		editContentType=3;
	}
		//获取险类和险种
	function sdbxzl(){
		//获取保险分类的数据
		var selected;
		$.ajax({
			url : "findTemplateInfo!findInsuranceSpecies.do",
			type : "POST",
			//data : "status=''",
			cache : false,
			//dataType: "json",
			success: function(data){
				//alert("保险种类："+data);
				//$("#insurance1").style.display="display";
				$("#xianzhong").empty();
				$.each(eval("(" + data + ")").list, function (index, item) {
					if(index == 0){
						selected = item.classCode;
						$("#xianzhong").append("<li class='action' id='"+item.classCode+"' onclick='findSpecific(\""+item.classCode+"\");'>"+item.classCName+"</li>");
					}else{
						//$("#xianzhong").append("<li id='"+item.classCode+"' onclick='findSpecific("+item.classCode+");'>"+item.classCName+"</li>");
						$("#xianzhong").append("<li id='"+item.classCode+"' onclick='findSpecific(\""+item.classCode+"\");'>"+item.classCName+"</li>");
					}
				});
				
				//获取具体的保险产品
				$.ajax({
					url : "findTemplateInfo!findSpecificInsurance.do",
					type : "POST",
					data : "classCode="+selected,
					cache : false,
					//dataType: "json",
					success: function(data){
						$("#xianlei").empty();
						$.each(eval("(" + data + ")").list, function (index, item) {
							//$("#xianlei").append("<li id='"+item.riskCode+"' onclick='tcinput("+item.riskCode+");'>"+item.riskCName+"</li>");
							$("#xianlei").append("<li id=\""+item.riskCode+"\" onclick='tcinput(\""+item.riskCode+"\",\""+item.riskCName+"\");'>"+item.riskCName+"</li>");
						});
					}
				});//------------
				
			}//---success
		});
		//使div显示
		$("#xlxz").css("display","block"); 
		
	}
	//点击时获取险种相对应的险类信息
	function findSpecific(classCode){
		//alert("pageNo:"+pageNo);
		$(".search-ul li").removeClass("action");
		$("#"+classCode).addClass("action");   //给选中的险类添加颜色
		$.ajax({
			url : "findTemplateInfo!findSpecificInsurance.do",
			type : "POST",
			data : "classCode="+classCode,
			cache : false,
			//dataType: "json",
			success: function(data){
				$("#xianlei").empty();
				$.each(eval("(" + data + ")").list, function (index, item) {
					//$("#xianlei").append("<li id='"+item.riskCode+"' onclick='inputText("+item.riskCode+","+item.riskCName+");'>"+item.riskCName+"</li>");
					$("#xianlei").append("<li id=\""+item.riskCode+"\" onclick='tcinput(\""+item.riskCode+"\",\""+item.riskCName+"\");'>"+item.riskCName+"</li>");
				});
			}
		});
	}
	function tcinput(riskCode,riskCName){
		$("#bxzlinput").val(riskCName);
		$("#xzdmdata").val(riskCode);
		$("#xlxz").css("display","none"); //隐藏div
	}
	function hiddalarm(){
		$(".sqlc").slideUp(2000);
	}
</script>
<head>
<meta charset="utf-8">
<title>新增送达模板</title>
<link rel="stylesheet" type="text/css" href="css/main.css">
<link rel="stylesheet" type="text/css" href="css/mobel-style.css">
</head>
<body>
<div class="mobel-con songda-add">&nbsp; 
  <br><br><br><!--10月10日整合版本--> 
  <dl class="breadcrumb">
      <dd><img src="img/con-electric.png"></dd>
      <dd><a href="#">送达模板	</a></dd>
      <dd>新增送达模板</dd>
      <div style="clear:both;"></div>
    </dl>  
  <div class="sqlc round-bk">
    <ul>
      <li class="add1">
        <span class="blue"></span>
        新增申请提交
      </li>
      <li class="add3">
        <span class="green"></span>
        总公司电子商务中心审批
      </li>
      <li class="add6">
        <span class="red"></span>发布
      </li>
    </ul>
    <div class="sqlc-tips pos-re">
      <!--此处有所改动，把h2换成了p标签，并且用br来进行换行。-->
      <p>
        <b style="color:#333;">温馨提示：</b><br>
        请在线下充分沟通后再进行线上审批，以免增加反复反工的风险！(<a href="#">查看线下联系方式</a>)
      </p>
      <a class="btn-close" href="#" onclick="hiddalarm();"></a>
    </div>
    <div style="clear:both;"></div>
  </div>
  
  <!--jibenxinxi-->
  <form name="sendTempForm" action="AddSendTemp.do" method="post">
  <input type="hidden" name="entity.suitableFor" value="11000000"/>
  <div class="jibenxinxi round-bk">
    <h1 class="f-16">基础信息</h1>
    <ul class="jibenxinxi-left">
      <li class="import">单证名称：<input name="entity.name" id="sendTempName" class="wd360" placeholder="如：加强电子保单"></li>
      <li class="baoxianzhonglei import">
        <span style="float:left;">保险种类：</span>
        <div class="bdzl-con" style="float:left;">
            <input class="wd360" placeholder="简拼/全拼/汉字" id="bxzlinput" name="entity.ptname" onfocus="sdbxzl();">
	        <div class="bxzl_tankuang tankuang" style="display:none" id="xlxz">
	          <!-- <p class="new-input">最近输入</p>
	          <p><a>机动车商业保险(DAA)</a><a>个人意外伤害保险(EAA)</a></p> -->
	          <ul class="search-ul" id="xianzhong">
	          </ul>
	          <ul class="security-list" id="xianlei">
	          </ul>
	        </div>
        </div>
        <div style=" clear:both;"></div>
      </li>
    </ul>
     <ul class="jibenxinxi-right">
      <li class="import" style="width:446px;">颁布类型<a class="baodan" onclick="zongban();">总颁</a><a class="pidan" onclick="shengban();">省颁</a></li>
      <input type="hidden" name="entity.pubType" id="sendTempbanbulx" value="总颁"/>
       <li class="shiyongshengfen import">
      <span style="float:left">适用省份：</span>
      	<div id="sendzbss">
        <s:select id="suitableFor1" name="selectProvince" list="addressList" listKey="comCode" listValue="comCName" cssStyle="wd360" multiple="true" size="3" headerKey="" headerValue="请选择适用省份"/>
        </div>
        <div id="sendsbss" style="display:none;">
        	<input id="suitableFor2" class="wd360" placeholder="简拼/全拼/汉字" value="北京" name="suitableForName">
        </div>
        <div style="clear:both"></div>
      </li>
    </ul>
    <div style="clear:both;"></div>
  </div>
  <!--tianjiafujian-->
  <div class="tianjiafujian round-bk add-sendmobel">
    <h1 class="f-16" style="margin-bottom:15px;">添加附件</h1>
    <ul class="unedit edit-email">
      <li class="state" id="emailstatus">（待编辑）</li>
      <li><a class="btn-danger" href="#" onclick="openEmail();">编辑邮件</a>
      	<input type="hidden" name="entity.emailContent" id="emailContent" value=""/>
      </li>
    </ul>
    <ul class="unedit edit-messag">
      <li class="state" id="smsstatus">（待编辑）</li>
      <li><a class="btn-danger" href="#" onclick="openMessage();">编辑短信</a>
      	<input type="hidden" name="entity.smsContent" id="msgContent" value=""/>
      </li>
    </ul>
    <ul class="unedit edit-weixin"> <!-- welledit -->
      <li class="state" id="wxstatus">（待编辑）</li>
      <li><a class="btn-success" href="#" onclick="openWX();">查看微信</a>
      	<input type="hidden" name="entity.wxContent" id="wxContent" value=""/>
      </li>
    </ul>
    <div style="clear:both;"></div>
  </div>
  <!--qitaxinxi-->
  <div class="qitaxinxi round-bk f-14">
    <h1 class="f-16">其他信息</h1>
    <p>
       <span>经办人：<b><s:property value="#session.APP_USER.name"/></b></span>
       <span class="ml-55">机构代码：<b>110000</b></span>
    </p>
    <span style=" display:inline-block; float: left; line-height:30px;">备注:</span>
    <textarea style="width:930px; margin-left:15px; color:#b2b2b2; font-size:14px" placeholder="如：交强险电子保单"></textarea>
    <a class="btn-submit f-16" href="#" onclick="Submit();">提交</a> 
  </div>
</div>
</form>
<div id="toEmailFile" style="position: absolute;top: 15%;left: 23%;z-index: 600;display: none ">
	 <textarea name="editEmail" id="editEmail" class="ckeditor"></textarea>
 </div>
 <div id="toMessageFile" style="position: absolute;top: 15%;left: 23%;z-index: 600;display: none ">
	 <textarea name="editMessage" id="editMessage" class="ckeditor"></textarea>
 </div>
 <div id="toWXFile" style="position: absolute;top: 15%;left: 23%;z-index: 600;display: none ">
	 <textarea name="editWX" id="editWX" class="ckeditor"></textarea>
 </div>
<script src="js/jquery-1.11.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(e) {
    $(".jibenxinxi-left .baodan").click(function(e){
		$(this).css({"background-color":"#eb5341","color":"#fff"}),$(".jibenxinxi-left .pidan").css({"background-color":"#e6e6e6","color":"#999"})
		})
	$(".jibenxinxi-left .pidan").click(function(e){
		$(this).css({"background-color":"#eb5341","color":"#fff"}),$(".jibenxinxi-left .baodan").css({"background-color":"#e6e6e6","color":"#999"});	
		})
	$(".jibenxinxi-right .baodan").click(function(e){
		$(this).css({"background-color":"#eb5341","color":"#fff"}),$(".jibenxinxi-right .pidan").css({"background-color":"#e6e6e6","color":"#999"})
		})
	$(".jibenxinxi-right .pidan").click(function(e){
		$(this).css({"background-color":"#eb5341","color":"#fff"}),$(".jibenxinxi-right .baodan").css({"background-color":"#e6e6e6","color":"#999"});	
		})
    /*$(".sqlc-tips .btn-close").click(function(e){
		$(".sqlc").slideUp(2000);
		});*/
});

</script>
<script>
	function Submit(){
		var tempname = $("#sendTempName").val();
		if($.trim(tempname).length == 0){
			alert("请输入单证名称");
			return;
		}
		var bxzlinput = $("#bxzlinput").val();
		if($.trim(bxzlinput).length == 0){
			alert("请选择保险种类");
			return;
		}
		var sendTempbanbulx = $("#sendTempbanbulx").val();
		if($.trim(sendTempbanbulx).length == 0){
			alert("请选择颁布类型");
			return;
		}
		var suitableFor1 = $("#suitableFor1").val();
		if($.trim(suitableFor1).length == 0){
			alert("请选择适用省份");
			return;
		}
		var emailContent = $("#emailContent").val();
		if($.trim(emailContent).length == 0){
			alert("邮件内容不能为空");
			return;
		}
		var msgContent = $("#msgContent").val();
		if($.trim(msgContent).length == 0){
			alert("短信内容不能为空");
			return;
		}
		sendTempForm.submit();
	}
</script>
</body>
</html>
